import TableOperate from '@/components/TableOperate';

const dataSource = [
    {
        key: '1',
        name: 'John Brown',
        age: 32,
        address: 'New York No. 1 Lake Park',
        children: [
            {
                key: '4',
                name: 'Jim',
                age: 42,
                address: 'London No. 1 Lake Park',
                children: [
                    {
                        key: '6',
                        name: 'Jim 6',
                        age: 42,
                        address: 'London No. 1 Lake Park',
                    },
                ],
            },
            {
                key: '5',
                name: 'Jim 5',
                age: 42,
                address: 'London No. 1 Lake Park',
                children: [
                    {
                        key: '7',
                        name: 'Jim 7',
                        age: 42,
                        address: 'London No. 1 Lake Park',
                    },
                ],
            },
            {
                key: '2',
                name: 'Jim Green',
                age: 42,
                address: 'London No. 1 Lake Park',
            },
            {
                key: '3',
                name: 'Joe Black',
                age: 32,
                address: 'Sidney No. 1 Lake Park',
            },
        ],
    },
];

const arrayOfObjects = [
    {
        disabled: false,
        name: '按钮1',
        onLinkClick: (e: any) => {
            console.log('按钮1被点击', e);
        }
    },
    {
        disabled: true,
        name: '按钮2',
        onLinkClick: (e: any) => {
            console.log('按钮2被点击', e);
        }
    },
    {
        disabled: false,
        name: '按钮3',
        onLinkClick: (e: any) => {
            console.log('按钮3被点击', e);
        }
    },
    {
        disabled: false,
        name: '按钮4',
        onLinkClick: (e: any) => {
            console.log('按钮4被点击', e);
        }
    },
    {
        disabled: true,
        name: '按钮5',
        tooltip: '这是按钮5的提示',
    }
];

const getColumns = () => {
    return [
        {
            title: 'Name',
            dataIndex: 'name',
            key: 'name',
        },
        {
            title: 'Age',
            dataIndex: 'age',
            key: 'age',
        },
        {
            title: 'Address',
            dataIndex: 'address',
            key: 'address',
        },
        {
            title: 'Action',
            key: 'action',
            render: (record: any) => <TableOperate data={record} options={arrayOfObjects} maxShowItem={4} />
        }
    ];
};

export {dataSource, getColumns};
